<?php
/**
* Provides interface for making all administrative database changes
* @author Nick Korbel <lqqkout13@users.sourceforge.net>
* @author David Poole <David.Poole@fccc.edu>
* @version 05-07-06
* @package Admin
*
* Copyright (C) 2003 - 2007 phpScheduleIt & 2010 ITOxygen
* License: GPL, see LICENSE
*/

include_once('lib/Template.class.php');
include_once('lib/Admin.class.php');
include_once('lib/User.class.php');
$t = new Template(translate('My Control Panel'));
$db = new DBEngine();

$t->printHTMLHeader();
$t->printWelcome();
$fn = isset($_POST['fn']) ? $_POST['fn'] : (isset($_GET['fn']) ? $_GET['fn'] : '');	// Set function

$user = new User(Auth::getCurrentID());

if (!validate_function($user, $fn)) {
    CmnFns::do_error_box(translate('This is only accessable to the administrator') . '<br />'
        . '<a href="ctrlpnl.php">' . translate('Back to My Control Panel') . '</a>');
}


// Print HTML headers
echo "<?xml version=\"1.0\" encoding=\"$charset\"?" . ">\n";
$t->startMain();
?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $languages[$lang][2]?>" lang="<?php echo $languages[$lang][2]?>">
	<head>
	<title>
	<?php echo translate('Manage Telemedicine')?>
	</title>
	<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset?>" />
	<script language="JavaScript" type="text/javascript" src="functions.js"></script>
	<style type="text/css">
	@import url(css.css);
	</style>
	</head>
	<body>
   <h3 align="center">Manage Telemedicine</h3>

   

<?php
  echo  '<p style="margin-top:10px;"><b>&raquo;</b> ' .  $link->getLink('admin.php?tool=presenters', translate('Manage Presenters')) . "</p>\n"; 
  echo  '<p style="margin-top:10px;"><b>&raquo;</b> ' .  $link->getLink('admin.php?tool=practitioners', translate('Manage Practitioners')) . "</p>\n"; 
  echo  '<p style="margin-top:10px;"><b>&raquo;</b> ' .  $link->getLink('admin.php?tool=insurances', translate('Manage Insurance')) . "</p>\n"; 
  echo  '<p style="margin-top:10px;"><b>&raquo;</b> ' .  $link->getLink('admin.php?tool=specialties', translate('Manage Specialties')) . "</p>\n";
//  echo  '<p style="margin-top:10px;"><b>&raquo;</b> ' .  $link->getLink('admin.php?tool=subspecialties', translate('Manage Subspecialties')) . "</p>\n";
// Print HTML footer
?>
	<p align="center"><a href="http://phpscheduleit.sourceforge.net">phpScheduleIt v<?php echo $conf['app']['version']?></a></p>
	</body>
	</html>
<?php
$t->endMain();
/**
* Return if the user can access the update page
* @param User $user the user to evaluate
* @param string $function the requested function
* @return if the user can access the update page
*/
function validate_function(&$user, $function) {
	if (Auth::isAdmin() || $user->get_isadmin()) {
		return true;
	}

	if ( $function == 'editPerms' || $function == 'resetPass' ) {
		return $user->is_group_admin();
	}

	return false;
}
?>
